package leetcode.code0822;

import java.util.Arrays;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int flipgame(int[] fronts, int[] backs) {
		boolean[] hash = new boolean[2001];
		for (int i = 0; i < fronts.length; i++) {
			if (fronts[i] == backs[i]) {
				hash[fronts[i]] = true;
			}
		}
		int ans = 2002;
		for (int i = 0; i < fronts.length; i++) {
			if (!hash[fronts[i]]) {
				ans = Math.min(ans, fronts[i]);
			}
			if (!hash[backs[i]]) {
				ans = Math.min(ans, fronts[i]);
			}
		}
		return ans == 2002 ? 0 : ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();

	}

}
